package com.bytic.miaosha.rabbitmq;

import com.bytic.miaosha.constant.MQConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MQConfig {

    @Bean
    public Queue queue() {
        return new Queue(MQConstant.MIAOSHA_QUEUE, true); // 第二个参数表示是否持久化
    }

    /*@Bean
    public DirectExchange directExchange() {
        return new DirectExchange(MQConstant.DIRECT_EXCHANGE, true, false);
    }

    @Bean
    public Binding bind() {
        return BindingBuilder.bind(queue()).to(directExchange()).with(MQConstant.QUEUE);
    }*/
}
